<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String phone = request.getParameter("phone");
%>
<html>
<head>
    <title>德先生去旅行</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
        }
        .sidebar {
            position: fixed;
            left: 0;
            top: 0;
            width: 200px;
            height: 100%;
            background-color: #333;
            color: #fff;
            padding: 20px;
            box-sizing: border-box;
        }
        .sidebar img {
            width: 60px; /* 可以根据实际需要调整头像大小 */
            height: 60px;
            border-radius: 50%; /* 圆形头像 */
            margin-bottom: 10px;
        }
        .sidebar a {
            color: #fff;
            text-decoration: none;
            display: block;
            padding: 10px;
            margin-bottom: 10px;
        }
        .sidebar a:hover {
            background-color: #555;
        }
        .main-content {
            margin-left: 200px;
            padding: 20px;
        }
        .container {
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            text-align: center;
            border: 1px solid #ddd;
            padding: 8px;
        }
        th {
            background-color: #4CAF50;
            color: white;
        }
        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
        .action-btn {
            color: #fff;
            background-color: #5cb85c;
            border: none;
            border-radius: 4px;
            padding: 5px 10px;
            text-decoration: none;
            margin-right: 5px;
        }
        .action-btn:hover {
            background-color: #4cae4c;
        }
        .search-btn {
            color: #fff;
            background-color: #337ab7;
            border: none;
            border-radius: 4px;
            padding: 5px 10px;
            text-decoration: none;
            margin-top: 20px;
            display: block;
            width: 150px;
            margin-left: auto;
            margin-right: auto;
        }
        .search-btn:hover {
            background-color: #286090;
        }
    </style>
</head>
<body>
<div class="sidebar" items="${userEntity}">
    <img src="img/begin.jpg" alt="User Avatar">
    <a href="#">${userEntity.name}</a>
    <a href="showFlight?phone=${userEntity.phone}">返回</a>
    <a href="index.jsp">退出</a>
</div>

<div class="main-content">
    <div class="container">
        <table>
            <thead>
            <tr>
                <th>航号</th>
                <th>航空公司</th>
                <th>出发机场</th>
                <th>达到机场</th>
                <th>出发时间</th>
                <th>到达时间</th>
                <th>机型</th>
                <th>费用</th>
                <th>操作</th>
            </tr>
            </thead>
            <c:forEach items="${flightEntities}" var="f">
                <tr>
                    <td>${f.flightId}</td>
                    <td>${f.company}</td>
                    <td>${f.departureAirport}</td>
                    <td>${f.arriveAirport}</td>
                    <td>${f.departureTime}</td>
                    <td>${f.arriveTime}</td>
                    <td>${f.model}</td>
                    <td>${f.cost}</td>
                    <td ><a href="toUpdateFlight?id=${f.id}&phone=<%=phone%>">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="deleteFlight?id=${f.id}&phone=<%=phone%>">删除</a></td>
                </tr>
            </c:forEach>
        </table>
        <a href="searchFlight.jsp?phone=<%=phone%>" class="search-btn">点击搜索</a><br>
        <a href="insertFlight.jsp?phone=<%=phone%>" class="search-btn">点击添加</a>
    </div>
</div>
</body>
</html>